﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="YYMM.ascx.cs" Inherits="Controls_YYMM" %>
<script runat="server">
    protected void ddlYYMM_DataBinding(object sender, EventArgs e)
    {
        ddlYYMM.Items.Clear();

        DateTime d = DateTime.Now.AddMonths(this.MonthPlus);
        string fmt = "{0:yyyyMM}";

        for (int i = 0; i < 10; i++)
        {
            ListItem it = new ListItem(string.Format(fmt, d), d.ToString());
            ddlYYMM.Items.Add(it);

            d = d.AddMonths(-1);
        }

        if (Optional)
        {
            ddlYYMM.Items.Insert(0, new ListItem(GetGlobalResourceObject("Form", "ddl.EmptyText").ToString(), string.Empty));
        }
    }
</script>
<My:MyDropDownList ID="ddlYYMM" runat="server" OnDataBinding="ddlYYMM_DataBinding"></My:MyDropDownList>